
import japa.parser.ASTParserTokenManager;
import japa.parser.JavaCharStream;
import japa.parser.JavaParser;
import japa.parser.ParseException;
import japa.parser.ast.Comment;
import japa.parser.ast.CompilationUnit;
import japa.parser.ast.ImportDeclaration;
import japa.parser.ast.PackageDeclaration;
import japa.parser.ast.body.BodyDeclaration;
import japa.parser.ast.body.JavadocComment;
import japa.parser.ast.body.TypeDeclaration;
import japa.parser.ast.expr.AnnotationExpr;
import japa.parser.ast.expr.NameExpr;
import japa.parser.ast.visitor.DumpVisitor;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

import java.util.LinkedList;
import java.util.List;

import sketch.ounit.Values;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class JapaConstrainTest extends TestCase {
	
	public static Test suite() {
		return new TestSuite(JapaConstrainTest.class);
	}
	
	public void testJapaParser() throws FileNotFoundException, ParseException {
		FileInputStream in = new FileInputStream("./subjects/sketchguided/japa/JapaSampleInput.java");
		CompilationUnit cu = JavaParser.parse(in);
		assertTrue(cu.equals(cu));
		Values.randomFuzz(cu, CompilationUnit.class, PackageDeclaration.class, NameExpr.class,
				ImportDeclaration.class, TypeDeclaration.class, LinkedList.class, Comment.class, DumpVisitor.class);
	}
	
	public void testJapaTypeDecl() throws Exception {
		FileInputStream in = new FileInputStream("./subjects/sketchguided/japa/JapaSampleInput.java");
		CompilationUnit cu = JavaParser.parse(in);
		List<TypeDeclaration> t = cu.getTypes();
		if(t.size() != 0) {
			Values.randomFuzz(t.get(0), TypeDeclaration.class, BodyDeclaration.class, List.class, JavadocComment.class, AnnotationExpr.class);
		}
	}
	
	public void testJapaASTTokenManager() throws Exception {
		JavaCharStream stream = new JavaCharStream(new FileInputStream("./subjects/sketchguided/japa/JapaSampleInput.java"));
		ASTParserTokenManager manager = new ASTParserTokenManager(stream);
		Values.randomFuzz(manager, ASTParserTokenManager.class);
	}
//	
//	public void testJapaDumper() throws Exception {
//		DumperVisitor visitor = new DumperVisitor();
//	}
}